package com.ycg.vue.modules.admin.controller;

import com.ycg.vue.Entity.Dto.UserDto;
import com.ycg.vue.Entity.UserEntity;
import com.ycg.vue.modules.admin.service.UserManageService;
import com.ycg.vue.result.Result;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.Map;

/**
 * @Description 用户管理
 * @Author jink
 * @Date 2024/5/21
 */
@Slf4j
@RestController
@RequestMapping("/admin/userManage")
public class UserManageController {

    @Resource
    private UserManageService userManageService;

    @PostMapping("/list")
    public Result list(@RequestBody UserDto userDto){
        return Result.success(userManageService.list(userDto));
    }

    @DeleteMapping("/deleteUser/{id}")
    public Result deleteUser(@PathVariable String id){
        return userManageService.deleteUser(id);
    }

    @GetMapping("/headImg")
    public Result headImg(){
        return Result.success(userManageService.headImg());
    }

    @PostMapping("/updateUser")
    public Result updateUser(@RequestBody UserEntity user){
        return userManageService.updateUser(user);
    }

    @GetMapping("/batchInsertUserTest/{num}")
    public void getUserInfo(@PathVariable Integer num){
        userManageService.batchInsertUser(num);
    }
}
